package com.woniuxy.controller;

import com.woniuxy.entity.Account;
import com.woniuxy.service.AccountService;

/**
 * 账号的注册
 */
public class AccountController {
    public void regiestAccount(Account account){
        AccountService accountService = new AccountService();
        int i = accountService.regiestCheckNumber(account);
        //i == 0 表示检查后无该账号
        if (i == 0) {
            accountService.regiestAccount(account);
        }else {
            System.out.println("该账号已生成！请勿重复尝试！");
        }
    }

    /**
     * 用户登陆用的方法
     * @param username
     * @param password
     */
    public void login(String username, String password) {
        AccountService accountService = new AccountService();
        accountService.login(username, password);
    }
}
